﻿<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>年度税收统计表</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->  
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>    
    <script language='javascript' src='~/Content/layer/layer.js'></script>
</head>
<body class="gray-bg">
    <div class="layui-tab layui-tab-brief main-tab-container ">

        <div class="col-sm-4 ct-padding">
            <div class="pull-right mail-search">
                <div class="input-group">
                    <input id="inputStr" type="text" class="form-control" placeholder="请输入年度(格式如：2017)">
                    <span class="input-group-btn" style="padding-left:10px">
                        <button id="btnSearch" class="layui-btn  layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-search"></span>查询 </button>
                        <button id="btnExport" class="layui-btn layui-btn-springgreen layui-btn-small"><span class="glyphicon glyphicon-share"></span> 导出 </button>
                    </span>
                </div>
            </div>
        </div>


        <div class="col-sm-12  layui-tab-content">
            <div class="mail-box" style="overflow-x:scroll;white-space:nowrap;">
                <table class="layui-table" lay-skin="line">
                    <thead>
                        <tr>
                            <th hidden>部门ID</th>
                            <th>部门</th>
                            <th>一月</th>
                            <th>二月</th>
                            <th>三月</th>
                            <th>四月</th>
                            <th>五月</th>
                            <th>六月</th>
                            <th>七月</th>
                            <th>八月</th>
                            <th>九月</th>
                            <th>十月</th>
                            <th>十一月</th>
                            <th>十二月</th>
                            <th>小计</th>
                        </tr>
                    </thead>
                    <tbody id="accordion"></tbody>
                </table>
            </div>
        </div>
       </div>
        <!-- 导出模态 -->
        <form action="/ReportForms/YearTaxStatMeg" enctype="multipart/form-data" method="post" id="formDownload">
            <div id="exportHtml" style="display:none;">
                <div class="eh_wrap">
                    <div class="eh_head">
                        <p style="">请选择您要导出的数据列</p>
                    </div>
                    <table width="100%" cellpadding="5" cellspacing="0">
                        <tr>
                            <td><input id="Dt_Name" type="checkbox" value="部门" name="chk_list" checked="checked" /><label>部门</label></td>
                        </tr>
                        <tr>
                            <td><input id="January" type="checkbox" value="一月" name="chk_list" checked="checked" /><label>一月</label></td>
                            <td><input id="February" type="checkbox" value="二月" name="chk_list" checked="checked" /><label>二月</label></td>
                            <td><input id="Marcy" type="checkbox" value="三月" name="chk_list" checked="checked" /><label>三月</label></td>
                            <td><input id="April" type="checkbox" value="四月" name="chk_list" checked="checked" /><label>四月</label></td>
                        </tr>
                        <tr>
                            <td><input id="May" type="checkbox" value="五月" name="chk_list" checked="checked" /><label>五月</label></td>
                            <td><input id="June" type="checkbox" value="六月" name="chk_list" checked="checked" /><label>六月</label></td>
                            <td><input id="July" type="checkbox" value="七月" name="chk_list" checked="checked" /><label>七月</label></td>
                            <td><input id="August" type="checkbox" value="八月" name="chk_list" checked="checked" /><label>八月</label></td>
                        </tr>
                        <tr>

                            <td><input id="September" type="checkbox" value="九月" name="chk_list" checked="checked" /><label>九月</label></td>
                            <td><input id="October" type="checkbox" value="十月" name="chk_list" checked="checked" /><label>十月</label></td>
                            <td><input id="November" type="checkbox" value="十一月" name="chk_list" checked="checked" /><label>十一月</label></td>
                            <td><input id="December" type="checkbox" value="十二月" name="chk_list" checked="checked" /><label>十二月</label></td>
                        </tr>
                        <tr>

                            <td><input id="xiaoji" type="checkbox" value="小计" name="chk_list" checked="checked" /><label>小计</label></td>
                        </tr>
                    </table>
                    <div class="box-footer">
                        <button type="submit" id="btnExportSure" class="layui-btn layui-btn-springgreen layui-btn-small pull-right" style=" margin-right:30px;">
                            <i class="fa fa-repeat"></i>导出
                        </button>
                        <input type="hidden" id="YearTaxStatMeg" name="YearTaxStatMeg" value="" />
                        <input type="hidden" id="where" name="where" value="" />
                    </div>
                </div>
            </div>
        </form>
</body>
</html>
<script>

    //页面加载时执行列表展示
    $(document).ready(function () {
        GetYearTaxStatInfo();
    });

    var html = "";
    var inputStr = "";
    //列表展示
    function GetYearTaxStatInfo(inputStr) {
        getAjax("/ReportForms/GetYearTaxStat", { "where": inputStr }, function (data) {
          
            accordionJson = eval("(" + data + ")");
            var January = 0, February = 0, Marcy = 0, April = 0, May = 0, June = 0, July = 0, August = 0, September = 0, October = 0, November = 0, December=0;
            var xiaoji = 0;
            $.each(accordionJson, function (i) {
                var xj=(accordionJson[i].January + accordionJson[i].February + accordionJson[i].Marcy + accordionJson[i].April + accordionJson[i].May + accordionJson[i].June + accordionJson[i].July + accordionJson[i].August + accordionJson[i].September + accordionJson[i].October + accordionJson[i].November + accordionJson[i].December)*0.01 ;
                html += "<tr>";
                html += "<td hidden>" + accordionJson[i].Dt_Id + "</td>";
                html += "<td>" + accordionJson[i].Dt_Name + "</td>";
                html += "<td>" + ((accordionJson[i].January) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].February) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].Marcy) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].April) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].May) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].June) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].July) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].August) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].September) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].October) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].November) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + ((accordionJson[i].December) * 0.01).toFixed(2) + "</td>";
                html += "<td>" + xj.toFixed(2)+ "</td>";
                html += "</tr>";
                January += Number(accordionJson[i].January);
                February += Number(accordionJson[i].February);
                Marcy += Number(accordionJson[i].Marcy);
                April += Number(accordionJson[i].April);
                May += Number(accordionJson[i].May);
                June += Number(accordionJson[i].June);
                July += Number(accordionJson[i].July);
                August += Number(accordionJson[i].August);
                September += Number(accordionJson[i].September);
                October += Number(accordionJson[i].October);
                November += Number(accordionJson[i].November);
                December += Number(accordionJson[i].December);
                xiaoji += Number(xj);
            });
                html += "<tr>";
                html += "<td hidden></td>";
                html += "<td style='color:red'>合计:</td>";
                html += "<td>" + (January * 0.01).toFixed(2) + "</td>";
                html += "<td>" + (February * 0.01).toFixed(2) + "</td>";
                html += "<td>" + (Marcy * 0.01).toFixed(2) +"</td>";
                html += "<td>" + (April * 0.01).toFixed(2) +"</td>";
                html += "<td>" + (May * 0.01).toFixed(2)  + "</td>";
                html += "<td>" + (June * 0.01).toFixed(2) +"</td>";
                html += "<td>" + (July * 0.01).toFixed(2)+"</td>";
                html += "<td>" + (August * 0.01).toFixed(2)+"</td>";
                html += "<td>" + (September * 0.01).toFixed(2)+"</td>";
                html += "<td>" + (October * 0.01).toFixed(2)+"</td>";
                html += "<td>" + (November * 0.01).toFixed(2)+"</td>";
                html += "<td>" + (December * 0.01).toFixed(2)+"</td>";
                html += "<td>" + xiaoji.toFixed(2)+ "</td>";
                html += "</tr>";
        })
       
        $("#accordion").empty().append(html);
    }
    //查询
    $(function () {
        $("#btnSearch").click(function () {
            var inputStr = $("#inputStr").val().trim();  //获取搜索条件
            html = "";
            GetYearTaxStatInfo(inputStr);
        })
    });

    /*导出*/
    $("#btnExport").click(function () {      
        layer.open({
            type: 1,
            title: '导出提示',
            shade: false,
            skin: 'layui-layer-rim',
            area: ['520px', '320px'], //宽高
            content: $('#exportHtml')
        });
    });
    /*导出交互*/
    $("#btnExportSure").click(function () {
        var arr = new Array();
        $("[name='chk_list']").each(function () {
            if ($(this).is(":checked")) {
                arr.push($(this).attr("id") + "|" + $(this).val());
            }
        });
        $("#YearTaxStatMeg").val(arr);
        document.getElementById('formDownload').submit();
        layer.closeAll();
    });
</script>


